<?php

/**
 * 检查过期门店
 */
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED);
ini_set('memory_limit', '1024M');

require_once '/data/wwwroot/g_vendor/autoload.php';

use Biz\model\store\StoreAccount as mStoreAccount;
use Biz\model\store\StoreBasic as mStoreBasic;
use Doraemon\cache\User as cUser;
use Doraemon\cache\UserAuthStatus as cUserAuthStatus;
use Doraemon\model\Member as mMember;

$accountList = mStoreAccount::select('*', ['auth_end_time[<]' => date('Y-m-d H:i:s')]);
foreach ($accountList as $row) {
    mStoreAccount::update(['auth_status' => mStoreAccount::AUTH_DEFAULT], ['store_id' => $row['store_id']]);
    mStoreBasic::updateById($row['store_id'], ['store_status' => mStoreBasic::STORE_STATUS_DEFAULT]);
    mMember::updateUserInfo($row['uid'], ['type' => mMember::USER_COMMON]);
    cUser::deleteUserInfo($row['uid']);
    cUserAuthStatus::setAuthType($row['uid'], mMember::USER_COMMON); // 标记用户强制退出
}



